<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
   //创建字符串对象(下标从0开始)
   var str = "  HelLo JS  ";//前面两个空格
   
   console.log(str);

   //charAt
   console.log(str.charAt(4));

   //indexOf
   console.log(str.indexOf("Lo"));
   
   //trim
   var s = str.trim();
   console.log(s);
   
   //substring(start,end) -- (开始索引,结束索引) 含头不含尾
   console.log(s.substring(0,5));//不能识别空格
   
</script>
</html>